import request from '@/router/axios';
import {downloadExcel} from '@/router/axios';
import {formatCondition} from '@/util/util';

//组件管理单条查询
export const querySysMicroComponent = (params) => {
  params.head.transCode = 'querySysMicroComponent';
  return request({
    url: '/micro/sysMicroComponent/querySysMicroComponent',
    method: 'post',
    data: params
  })
}
//组件管理多条列表查询，支持条件查询
export const querySysMicroComponentListPage = (params) => {
  params.head.transCode = 'querySysMicroComponentListPage';
  return request({
    url: '/micro/sysMicroComponent/querySysMicroComponentListPage',
    method: 'post',
    data: params
  })
}
//组件管理新增单条记录
export const saveSysMicroComponent = (params) => {
  params.head.transCode = 'saveSysMicroComponent';
  return request({
    url: '/micro/sysMicroComponent/saveSysMicroComponent',
    method: 'post',
    data: params
  })
}
//组件管理新增多条记录
export const saveSysMicroComponentList = (params) => {
  params.head.transCode = 'saveSysMicroComponentList';
  return request({
    url: '/micro/sysMicroComponent/saveSysMicroComponentList',
    method: 'post',
    data: params
  })
}
//组件管理新增或修改单条记录
export const saveOrUpdateSysMicroComponent = (params) => {
  params.head.transCode = 'saveOrUpdateSysMicroComponent';
  return request({
    url: '/micro/sysMicroComponent/saveOrUpdateSysMicroComponent',
    method: 'post',
    data: params
  })
}


//组件管理新增或修改单条记录
export const saveOrUpdateSysMicroComponentList = (params) => {
  params.head.transCode = 'saveOrUpdateSysMicroComponentList';
  return request({
    url: '/micro/sysMicroComponent/saveOrUpdateSysMicroComponentList',
    method: 'post',
    data: params
  })
}

//组件管理修改单条记录
export const updateSysMicroComponent = (params) => {
  params.head.transCode = 'updateSysMicroComponent';
  return request({
    url: '/micro/sysMicroComponent/updateSysMicroComponent',
    method: 'post',
    data: params
  })
}

//组件管理删除单条记录
export const deleteSysMicroComponent = (params) => {
  params.head.transCode = 'deleteSysMicroComponent';
  return request({
    url: '/micro/sysMicroComponent/deleteSysMicroComponent',
    method: 'post',
    data: params
  })
}

//组件管理删除多条记录
export const deleteSysMicroComponentList = (params) => {
  params.head.transCode = 'deleteSysMicroComponentList';
  return request({
    url: '/micro/sysMicroComponent/deleteSysMicroComponentList',
    method: 'post',
    data: params
  })
}
//组件管理导出excel
export const exportSysMicroComponentExcel = (params) => {
  downloadExcel({
    url: '/micro/sysMicroComponent/excelDownload/exportSysMicroComponentExcel',
    method: 'get',
    data: 
    {
      tenantId: params.head.tenantId,
      orders:'',
      condition: formatCondition(params.body.sqlCondition)
    }
  })
}
